package cn.hnbjx.prepaid.common;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class ClientInterceptor implements HandlerInterceptor {
    /**
     * 在执行controller方法之前执行,如果返回true代表放行,如果返回false代表不放行。
     */
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
        String queryString = request.getQueryString();
//        if(queryString != null && queryString.contains("uniCode")){
//            return true;
//        }
//        String openid = (String) request.getSession().getAttribute("openid");
//        if (null == openid) {    //代表用户没有登陆
//            throw new BusinessException(BusinessStatus.NOT_LOGIN);
//        }
        return true;    // 如果没进入if表示登录了,可以访问controller
    }
}